var canvas=document.getElementById('myCanvas');
canvas.width=877;
canvas.height=672;
var context=canvas.getContext('2d');
var img=new Image();
img.src='1.png';
var radius=50;
img.onload=function(){
	console.log('加载图片事件');
	initCanvas();
}
function initCanvas(){
	console.log('initCanvas函数');
	context.clearRect(0,0,canvas.width,canvas.height);
	context.save();
	context.beginPath();
	var x=Math.random()*(canvas.width-2*radius)+radius;
	var y=Math.random()*(canvas.height-2*radius)+radius;
	console.log(x);
	console.log(y);
	context.arc(x,y,radius,0,2*Math.PI,true);
	context.clip();
	context.drawImage(img,0,0);
	context.restore();
}
function reset(){
	console.log('reset');
	initCanvas();
}
function show(){
	console.log('show');
	radius=4*Math.max(canvas.width,canvas.height);
	initCanvas();
}
